package routes

import (
	"github.com/goravel/framework/contracts/http"
	"github.com/goravel/framework/facades"
	"goravel/app/http/controllers"
	"goravel/packages/socket/servers"
)

func Web() {
	facades.Route().Get("/", func(ctx http.Context) http.Response {
		return ctx.Response().View().Make("index.html")
	})
	// swagger
	swaggerController := controllers.NewSwaggerController()
	facades.Route().Get("/swagger/*any", swaggerController.Index)
	//	指定文件路由
	facades.Route().Static("/upload", "./public/upload")

	facades.Route().Static("/dist", "./public/dist")
	facades.Route().Static("/sheet", "./public/sheet")
	websocketHandler := &servers.Controller{}
	facades.Route().Get("/ws", websocketHandler.Run)
	go servers.Manager.Start()
}
